﻿/// <summary>
/// 常量数据类型，在文件中使用
/// </summary>

public partial class FixedVec3Data 
{
    public float x;
    public float y;
    public float z;

    public FixedVec3Data() { }

    public FixedVec3Data(float x, float y, float z)
    {
        this.x = x;
        this.y = y;
        this.z = z;
    }
#if UNITY_EDITOR
    public static implicit operator FixedVec3Data(UnityEngine.Vector2 v)
    {
        return new FixedVec3Data(v.x, v.y, 0);
    }
    /// 在Unity下与Vector2互转
    public static implicit operator UnityEngine.Vector2(FixedVec3Data v)
    {
        return new UnityEngine.Vector2(v.x, v.y);
    }
    /// 在Unity下与Vector3互转
    public static implicit operator FixedVec3Data(UnityEngine.Vector3 v)
    {
        return new FixedVec3Data(v.x, v.y, v.z);
    }
    /// 在Unity下与Vector3互转
    public static implicit operator UnityEngine.Vector3(FixedVec3Data v)
    {
        return new UnityEngine.Vector3(v.x, v.y, v.z);
    }
#endif
    public static implicit operator FixedVec3Data(FixedVec2 v)
    {
        return new FixedVec3Data(v.x, v.y, 0);
    }
    public static implicit operator FixedVec2(FixedVec3Data v)
    {
        return new FixedVec2(v.x, v.y);
    }
    public static implicit operator FixedVec3Data(FixedVec3 v)
    {
        return new FixedVec3Data(v.x, v.y, v.z);
    }
    public static implicit operator FixedVec3(FixedVec3Data v)
    {
        return new FixedVec3(v.x, v.y, v.z);
    }

    public static FixedVec3Data[] FromArray(FixedVec3[] df)
    {
        if (df == null)
            return null;

        FixedVec3Data[] res = new FixedVec3Data[df.Length];
        for (int i = 0; i < df.Length; i++)
        {
            res[i] = df[i];
        }
        return res;
    }

    public static FixedVec3[] ToArray(FixedVec3Data[] df)
    {
        if (df == null)
            return null;

        FixedVec3[] res = new FixedVec3[df.Length];
        for (int i = 0; i < df.Length; i++)
        {
            res[i] = df[i];
        }
        return res;
    }
}


public partial class FixedVec2Data 
{
    public float x;
    public float y;


    public FixedVec2Data() { }

    public FixedVec2Data(float x, float y)
    {
        this.x = x;
        this.y = y;
    }

#if UNITY_EDITOR
    public static implicit operator FixedVec2Data(UnityEngine.Vector2 v)
    {
        return new FixedVec2Data(v.x, v.y);
    }
    /// 在Unity下与Vector2互转
    public static implicit operator UnityEngine.Vector2(FixedVec2Data v)
    {
        return new UnityEngine.Vector2(v.x, v.y);
    }
    #endif
  
    public static implicit operator FixedVec2Data(FixedVec2 v)
    {
        return new FixedVec2Data(v.x, v.y);
    }
    public static implicit operator FixedVec2(FixedVec2Data v)
    {
        return new FixedVec2(v.x, v.y);
    }

    public static FixedVec2Data[] FromArray(FixedVec2[] df)
    {
        if (df == null)
            return null;

        FixedVec2Data[] res = new FixedVec2Data[df.Length];
        for (int i = 0; i < df.Length; i++)
        {
            res[i] = df[i];
        }
        return res;
    }

    public static FixedVec2[] ToArray(FixedVec2Data[] df)
    {
        if (df == null)
            return null;

        FixedVec2[] res = new FixedVec2[df.Length];
        for (int i = 0; i < df.Length; i++)
        {
            res[i] = df[i];
        }
        return res;
    }
}

public partial class FixedVec4Data
{
    public float x;
    public float y;
    public float z;
    public float w;

    public FixedVec4Data()
    {

    }

    public FixedVec4Data(float x, float y, float z,float w)
    {
        this.x = x;
        this.y = y;
        this.z = z;
        this.w = w;
    }

#if UNITY_EDITOR
    public static implicit operator FixedVec4Data(UnityEngine.Vector3 v)
    {
        return new FixedVec4Data(v.x, v.y,v.z, 0);
    }
    public static implicit operator UnityEngine.Vector3(FixedVec4Data v)
    {
        return new UnityEngine.Vector3(v.x, v.y, v.z);
    }
    public static implicit operator FixedVec4Data(UnityEngine.Vector4 v)
    {
        return new FixedVec4Data(v.x, v.y, v.z, v.w);
    }
    public static implicit operator UnityEngine.Vector4(FixedVec4Data v)
    {
        return new UnityEngine.Vector4(v.x, v.y, v.z,v.w);
    }
#endif
    public static implicit operator FixedVec4Data(FixedVec3 v)
    {
        return new FixedVec4Data(v.x, v.y, v.z,0);
    }
    public static implicit operator FixedVec3(FixedVec4Data v)
    {
        return new FixedVec3(v.x, v.y,v.z);
    }
    public static implicit operator FixedVec4Data(FixedVec4 v)
    {
        return new FixedVec4Data(v.x, v.y, v.z,v.w);
    }
    public static implicit operator FixedVec4(FixedVec4Data v)
    {
        return new FixedVec4(v.x, v.y, v.z,v.w);
    }

    public static FixedVec4Data[] FromArray(FixedVec4[] df)
    {
        if (df == null)
            return null;

        FixedVec4Data[] res = new FixedVec4Data[df.Length];
        for (int i = 0; i < df.Length; i++)
        {
            res[i] = df[i];
        }
        return res;
    }

    public static FixedVec4[] ToArray(FixedVec4Data[] df)
    {
        if (df == null)
            return null;

        FixedVec4[] res = new FixedVec4[df.Length];
        for (int i = 0; i < df.Length; i++)
        {
            res[i] = df[i];
        }
        return res;
    }
}